//
//  APOStudent.m
//  Apallo
//
//  Created by Jason Poh on 18/8/14.
//  Copyright (c) 2014 Apallo. All rights reserved.
//

#import "APOStudent.h"

@implementation APOStudent

NSString *const APOStudentFullName = @"APOStudentFullName";
NSString *const APOStudentNickname = @"APOStudentNickname";
NSString *const APOStudentDescription = @"APOStudentDescription";
NSString *const APOStudentInterests = @"APOStudentInterests";
NSString *const APOStudentFaculty = @"APOStudentFaculty";
NSString *const APOStudentMajor = @"APOStudentMajor";
NSString *const APOStudentPhoto = @"APOStudentPhoto";
NSString *const APOStudentPhotoSmall = @"APOStudentPhotoSmall";
NSString *const APOStudentQBID = @"APOStudentQBID";
NSString *const APOStudentMatricNo = @"APOStudentMatricNo";
NSString *const APOStudentYearMatriculated = @"APOStudentYearMatriculated";
NSString *const APOStudentEmail = @"APOStudentEmail";
NSString *const APOStudentThumbsCount = @"APOStudentThumbsCount";
NSString *const APOStudentDBID = @"APOStudentDBID";

- (id)init
{
    if ( (self = [super init]) ) {
        _full_name = @"";
        _nickname = @"";
        _description = @"";
        _interests = @"";
        _faculty = @"";
        _major = @"";
        _photo = @"";
        _photo_small = @"";
        _qbid = @"";
        _matric_no = @"";
        _year_matriculated = @"";
        _email = @"";
        _thumbs_count = 0;
        _db_id = @"";
    }
    return self;
}

- (void)encodeWithCoder:(NSCoder *)coder {
    [coder encodeObject:self.full_name forKey:APOStudentFullName];
    [coder encodeObject:self.nickname forKey:APOStudentNickname];
    [coder encodeObject:self.description forKey:APOStudentDescription];
    [coder encodeObject:self.interests forKey:APOStudentInterests];
    [coder encodeObject:self.faculty forKey:APOStudentFaculty];
    [coder encodeObject:self.major forKey:APOStudentMajor];
    [coder encodeObject:self.photo forKey:APOStudentPhoto];
    [coder encodeObject:self.photo_small forKey:APOStudentPhotoSmall];
    [coder encodeObject:self.qbid forKey:APOStudentQBID];
    [coder encodeObject:self.matric_no forKey:APOStudentMatricNo];
    [coder encodeObject:self.year_matriculated forKey:APOStudentYearMatriculated];
    [coder encodeObject:self.email forKey:APOStudentEmail];
    [coder encodeInt:self.thumbs_count forKey:APOStudentThumbsCount];
    [coder encodeObject:self.db_id forKey:APOStudentDBID];
}

- (id)initWithCoder:(NSCoder *)coder {
    self = [super init];
    if (self) {
        _full_name = [coder decodeObjectForKey:APOStudentFullName];
        _nickname = [coder decodeObjectForKey:APOStudentNickname];
        _description = [coder decodeObjectForKey:APOStudentDescription];
        _interests = [coder decodeObjectForKey:APOStudentInterests];
        _faculty = [coder decodeObjectForKey:APOStudentFaculty];
        _major = [coder decodeObjectForKey:APOStudentMajor];
        _photo = [coder decodeObjectForKey:APOStudentPhoto];
        _photo_small =  [coder decodeObjectForKey:APOStudentPhotoSmall];
        _qbid = [coder decodeObjectForKey:APOStudentQBID];
        _matric_no = [coder decodeObjectForKey:APOStudentMatricNo];
        _year_matriculated = [coder decodeObjectForKey:APOStudentYearMatriculated];
        _email = [coder decodeObjectForKey:APOStudentEmail];
        _thumbs_count = [coder decodeIntegerForKey:APOStudentThumbsCount];
        _db_id = [coder decodeObjectForKey:APOStudentDBID];
        
    }
    return self;
}

-(void) debugPrint
{
    NSLog(@"APOStudent - db_id: %@", self.db_id);
    NSLog(@"APOStudent - full_name: %@", self.full_name);
    NSLog(@"APOStudent - nickname: %@", self.nickname);
    NSLog(@"APOStudent - description: %@", self.description);
    NSLog(@"APOStudent - interests: %@", self.interests);
    NSLog(@"APOStudent - faculty: %@", self.faculty);
    NSLog(@"APOStudent - major: %@", self.major);
    NSLog(@"APOStudent - photo: %@", self.photo);
    NSLog(@"APOStudent - photo_small: %@", self.photo_small);
    NSLog(@"APOStudent - qbid: %@", self.qbid);
    NSLog(@"APOStudent - matric_no: %@", self.matric_no);
    NSLog(@"APOStudent - year_matriculated: %@", self.year_matriculated);
    NSLog(@"APOStudent - email: %@", self.email);
    NSLog(@"APOStudent - thumbs_count: %d", self.thumbs_count);
}

@end
